<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<%
pageContext.setAttribute("crlf", "\r\n");
pageContext.setAttribute("lf", "\n");
pageContext.setAttribute("cr", "\r");
%>
<script type="text/javascript">
$(document).ready(function(){

});

</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check_comm( frm ){
	var rtn = true;
	if( rtn == true && frm.aid.value.length < 1 ) {
		alert('해당글이 존재하지 않습니다.');
		rtn = false;
	}
	if( rtn == true && frm.uname.value.length < 2 ) {
		alert('이름 입력해주세요.');
		frm.uname.focus();
		rtn = false;
	}
	if( rtn == true && frm.pw.value.length < 2 ) {
		alert('비밀번호를 입력해주세요.');
		frm.pw.focus();
		rtn = false;
	}
	if( rtn == true && frm.comm.value.length < 2 ) {
		alert('내용을 입력해주세요.');
		frm.comm.focus();
		rtn = false;
	}
	return rtn;
}

function pcheck_comm( frm ){
	if( check_comm( frm ) == true ) {
		get_Scode_comm( frm.scode.value );
	}
	return false;
}
//-->
</SCRIPT>

	<SCRIPT LANGUAGE='JavaScript'>
	<!--
	function download(gid,bid,fname){
		window.open('/pboard/pboard_download.php?&gid=&bid=mcubeps_06&aid=11340000000000&file=', 'board_download', 'width=100 height=50');					
		}
	//-->
	</SCRIPT>
<script type="text/javascript">
<!--
function del_comm( parent , no ){
	frm = document.all(parent);
	selected_comm_no = no;
	document.getElementById(no).style.display = 'block';
	frm.comm_pw.focus();
}

function submitPwdChk(idx){
	if($("#bc_pwd_"+idx).val()==""){
		alert('비밀번호를 입력하세요');
		$("#bc_pwd_"+idx).focus();
		return false;
	}else{
		if(confirm("삭제하시겠습니까?")){
			$("#frmDel_"+idx).submit();	
		}
	}

}
//-->
</script>

<table width="100%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td valign="top" align="center">
			<TABLE cellpadding="0" cellspacing="0" width="100%">
				<TR>
					<TD>
						<table cellspacing="0" cellpadding="0" border="0" width="100%"
							style="margin: 20px 0px 4px 0px">
							<tr valign="bottom">
								<td align="right"><a
									href="./ubdmg0101Q.do?p_id=${param.p_id }&brd_no=${param.brd_no}"
									class="ebbaord-default"><img
										src='/usr/images/ic-list.gif' border='0'
										vspace='0'></a> <a
									href="./ubdmg0110Q.do?p_id=${param.p_id }&brd_no=${param.brd_no }&bd_no=${param.bd_no}&type=1"
									class="ebbaord-default"><img
										src='/usr/images/ic-modify.gif' border='0'
										vspace='0'></a> <a
									href="./ubdmg0110Q.do?p_id=${param.p_id }&brd_no=${param.brd_no }&bd_no=${param.bd_no}&type=2"
									class="ebbaord-default"><img
										src='/usr/images/ic-del.gif' border='0'
										vspace='0'></a> <a
									href="./ubdmg0102Q.do?p_id=${param.p_id }&brd_no=${param.brd_no }"
									class="ebbaord-default"><img
										src='/usr/images/ic-write.gif' border='0'
										vspace='0'></a></td>
							</tr>
						</table> <!-- view -->
						<table cellspacing="0" cellpadding="0" border="0" width="100%"
							id="tb_view">
							<tr>
								<td colspan="6" height="1" class="css_line"></td>
							</tr>
							<tr height="28">
								<td colspan="2" class="css_title">제목 : ${map.bd_title }</td>
							</tr>
							<tr>
								<td colspan="2" height="1" class="css_line"></td>
							</tr>
							<tr height="28">
								<td width="70%" class="css" align="left">이름 :
									${map.bd_name }&nbsp;&nbsp;&nbsp;작성일 : ${map.reg_dt }</td>
								<td width="30%" class="css" align="right">조회 :
									${map.bd_hit }&nbsp;&nbsp;</td>
							</tr>
							<tr>
								<td colspan="2" height="1" class="css_line"></td>
							</tr>
							<tr height="200" valign="top">
								<td colspan="2" class="view" style="padding-bottom: 10px">
									<div class="view_scroll">
										<TABLE width="100%" cellspacing="5" id="board_table">
											<TR>
												<TD width="5"></TD>
												<TD valign="top" align="left" class="css">
<c:if test="${fileList !=null && fn:length(fileList)>0 }">
	<c:forEach var="map1" items="${fileList}" varStatus="status">
		<img src="${map1.p_file_nm }" style="width: 600px;padding: 3px;"><br/>
	</c:forEach>
</c:if>
													<style>
P {
	MARGIN-TOP: 2px;
	MARGIN-BOTTOM: 2px;
}
</style>
${fn:replace(map.bd_content, cr, "<br/>")}
												</TD>
												<TD width=5></TD>
											</TR>
										</TABLE>
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="2" height="1" class="css_line"></td>
							</tr>
						</table>

					</TD>
				</TR>
			</TABLE>
			<CENTER>
				<TABLE cellspacing="10">
					<TR>
					</TR>
				</TABLE>
			</CENTER>

<c:if test="${cmtList !=null && fn:length(cmtList)>0 }">
	<c:forEach var="map1" items="${cmtList}" varStatus="status">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" style="text-align: left;padding-bottom: 10px;">
				<FORM id="frmDel_${status.index }" action="./ubdmg0109T.do" method="post">
					<input name="p_id" value="${param.p_id }" type="hidden"/>
					<input name="brd_no" value="${param.brd_no}" type="hidden"/>
					<input name="bd_no" value="${param.bd_no }" type="hidden"/>
					<input name="bd_cmt_no" value="${map1.bd_cmt_no }" type="hidden"/>
					<tr id="comm_span_756">
						<td class="css_comm"><B>${map1.bc_nm } &nbsp;&nbsp;&nbsp;&nbsp;
								${map1.reg_dt } <A
								HREF="javascript:del_comm('frmDel_${status.index }','commPw_span_${status.index }')"
								style="text-decoration: none; font-size: 8pt; padding: 23px 0px 0px 0px;"
								class="css_default"><img
									src="/usr/images/btn_comm_delete.gif" width="17" height="15"
									border="0" alt="삭제" align="absmiddle" style=""></A><span
								id="commPw_span_${status.index }" style="display: none" align="left">비밀번호
									: <INPUT TYPE="passwd" NAME="bc_pwd" id="bc_pwd_${status.index }" size="5"> <input
									type="submit" value="삭제"
									onclick="submitPwdChk('${status.index }');return false;">
							</span>
						</B> <br> ${fn:replace(map1.bc_content, cr, "<br/>")}</td>
					</tr>
				</FORM>
			</table>
	</c:forEach>
</c:if>

			<table width="100%" border="0" cellspacing="0" cellpadding="15">
				<form name="commform" action="./ubdmg0108T.do" method="post">
					<input type="hidden" name="p_id" value="${param.p_id }">
					<input type="hidden" name="brd_no" value="${param.brd_no }">
					<input type="hidden" name="bd_no" value="${param.bd_no }">
					<tr>
						<td align="left">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td colspan="2" align="left" class="css_default">이름 : <INPUT
										TYPE="text" NAME="bc_nm" value="" size="10" maxlength="10"
										size="10" class="css_input"> &nbsp;&nbsp; 비밀번호 : <INPUT
										TYPE="passwd" NAME="bc_pwd" size="10" maxlength="10"
										class="css_input"> 입력코드 : <input type="text"
										name="answer" maxlength="10" size="10" class="css_input">
										
										<img id="chaImg" src="/captcha/simpleCaptcha.png" border="0" align="absmiddle" style="height: 30px;">
										<a href="#" onclick="$('#chaImg').attr('src','/captcha/simpleCaptcha.png');return false;">[새로고침]</a>
									</td>
								</tr>
								<tr>
									<td align="left" style="height: 60px;"><textarea
											name="bc_content" id="bc_content" cols="80" rows="3"
											style="width: 98%; height: 60px;" class="css_textarea"></textarea></td>
									<td align="right" style="width: 10%; height: 60px;"><input
										type="image" src="/usr/images/co_btn_write.gif"
										border="0" style="vertical-align: top"></td>
								</tr>
							</table>
						</td>
					</tr>
				</form>
			</table>
		</td>
	</tr>
</table>
